/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Core.impl;

import EA_Model.IEC61970.Core.Bay;
import EA_Model.IEC61970.Core.BreakerConfiguration;
import EA_Model.IEC61970.Core.BusbarConfiguration;
import EA_Model.IEC61970.Core.CorePackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Bay</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Core.impl.BayImpl#getBayEnergyMeasFlag <em>Bay Energy Meas Flag</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.BayImpl#getBayPowerMeasFlag <em>Bay Power Meas Flag</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.BayImpl#getBreakerConfiguration <em>Breaker Configuration</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.BayImpl#getBusBarConfiguration <em>Bus Bar Configuration</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BayImpl extends EquipmentContainerImpl implements Bay {
	/**
	 * The cached value of the '{@link #getBayEnergyMeasFlag() <em>Bay Energy Meas Flag</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBayEnergyMeasFlag()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean bayEnergyMeasFlag;

	/**
	 * The cached value of the '{@link #getBayPowerMeasFlag() <em>Bay Power Meas Flag</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBayPowerMeasFlag()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean bayPowerMeasFlag;

	/**
	 * The default value of the '{@link #getBreakerConfiguration() <em>Breaker Configuration</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBreakerConfiguration()
	 * @generated
	 * @ordered
	 */
	protected static final BreakerConfiguration BREAKER_CONFIGURATION_EDEFAULT = BreakerConfiguration.SINGLE_BREAKER;

	/**
	 * The cached value of the '{@link #getBreakerConfiguration() <em>Breaker Configuration</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBreakerConfiguration()
	 * @generated
	 * @ordered
	 */
	protected BreakerConfiguration breakerConfiguration = BREAKER_CONFIGURATION_EDEFAULT;

	/**
	 * The default value of the '{@link #getBusBarConfiguration() <em>Bus Bar Configuration</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBusBarConfiguration()
	 * @generated
	 * @ordered
	 */
	protected static final BusbarConfiguration BUS_BAR_CONFIGURATION_EDEFAULT = BusbarConfiguration.SINGLE_BUS;

	/**
	 * The cached value of the '{@link #getBusBarConfiguration() <em>Bus Bar Configuration</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBusBarConfiguration()
	 * @generated
	 * @ordered
	 */
	protected BusbarConfiguration busBarConfiguration = BUS_BAR_CONFIGURATION_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BayImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CorePackage.Literals.BAY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getBayEnergyMeasFlag() {
		if (bayEnergyMeasFlag != null && bayEnergyMeasFlag.eIsProxy()) {
			InternalEObject oldBayEnergyMeasFlag = (InternalEObject)bayEnergyMeasFlag;
			bayEnergyMeasFlag = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldBayEnergyMeasFlag);
			if (bayEnergyMeasFlag != oldBayEnergyMeasFlag) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.BAY__BAY_ENERGY_MEAS_FLAG, oldBayEnergyMeasFlag, bayEnergyMeasFlag));
			}
		}
		return bayEnergyMeasFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetBayEnergyMeasFlag() {
		return bayEnergyMeasFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBayEnergyMeasFlag(EA_Model.IEC61970.Domain.Boolean newBayEnergyMeasFlag) {
		EA_Model.IEC61970.Domain.Boolean oldBayEnergyMeasFlag = bayEnergyMeasFlag;
		bayEnergyMeasFlag = newBayEnergyMeasFlag;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BAY__BAY_ENERGY_MEAS_FLAG, oldBayEnergyMeasFlag, bayEnergyMeasFlag));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getBayPowerMeasFlag() {
		if (bayPowerMeasFlag != null && bayPowerMeasFlag.eIsProxy()) {
			InternalEObject oldBayPowerMeasFlag = (InternalEObject)bayPowerMeasFlag;
			bayPowerMeasFlag = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldBayPowerMeasFlag);
			if (bayPowerMeasFlag != oldBayPowerMeasFlag) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.BAY__BAY_POWER_MEAS_FLAG, oldBayPowerMeasFlag, bayPowerMeasFlag));
			}
		}
		return bayPowerMeasFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetBayPowerMeasFlag() {
		return bayPowerMeasFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBayPowerMeasFlag(EA_Model.IEC61970.Domain.Boolean newBayPowerMeasFlag) {
		EA_Model.IEC61970.Domain.Boolean oldBayPowerMeasFlag = bayPowerMeasFlag;
		bayPowerMeasFlag = newBayPowerMeasFlag;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BAY__BAY_POWER_MEAS_FLAG, oldBayPowerMeasFlag, bayPowerMeasFlag));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BreakerConfiguration getBreakerConfiguration() {
		return breakerConfiguration;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBreakerConfiguration(BreakerConfiguration newBreakerConfiguration) {
		BreakerConfiguration oldBreakerConfiguration = breakerConfiguration;
		breakerConfiguration = newBreakerConfiguration == null ? BREAKER_CONFIGURATION_EDEFAULT : newBreakerConfiguration;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BAY__BREAKER_CONFIGURATION, oldBreakerConfiguration, breakerConfiguration));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BusbarConfiguration getBusBarConfiguration() {
		return busBarConfiguration;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBusBarConfiguration(BusbarConfiguration newBusBarConfiguration) {
		BusbarConfiguration oldBusBarConfiguration = busBarConfiguration;
		busBarConfiguration = newBusBarConfiguration == null ? BUS_BAR_CONFIGURATION_EDEFAULT : newBusBarConfiguration;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BAY__BUS_BAR_CONFIGURATION, oldBusBarConfiguration, busBarConfiguration));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.BAY__BAY_ENERGY_MEAS_FLAG:
				if (resolve) return getBayEnergyMeasFlag();
				return basicGetBayEnergyMeasFlag();
			case CorePackage.BAY__BAY_POWER_MEAS_FLAG:
				if (resolve) return getBayPowerMeasFlag();
				return basicGetBayPowerMeasFlag();
			case CorePackage.BAY__BREAKER_CONFIGURATION:
				return getBreakerConfiguration();
			case CorePackage.BAY__BUS_BAR_CONFIGURATION:
				return getBusBarConfiguration();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.BAY__BAY_ENERGY_MEAS_FLAG:
				setBayEnergyMeasFlag((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case CorePackage.BAY__BAY_POWER_MEAS_FLAG:
				setBayPowerMeasFlag((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case CorePackage.BAY__BREAKER_CONFIGURATION:
				setBreakerConfiguration((BreakerConfiguration)newValue);
				return;
			case CorePackage.BAY__BUS_BAR_CONFIGURATION:
				setBusBarConfiguration((BusbarConfiguration)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.BAY__BAY_ENERGY_MEAS_FLAG:
				setBayEnergyMeasFlag((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case CorePackage.BAY__BAY_POWER_MEAS_FLAG:
				setBayPowerMeasFlag((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case CorePackage.BAY__BREAKER_CONFIGURATION:
				setBreakerConfiguration(BREAKER_CONFIGURATION_EDEFAULT);
				return;
			case CorePackage.BAY__BUS_BAR_CONFIGURATION:
				setBusBarConfiguration(BUS_BAR_CONFIGURATION_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.BAY__BAY_ENERGY_MEAS_FLAG:
				return bayEnergyMeasFlag != null;
			case CorePackage.BAY__BAY_POWER_MEAS_FLAG:
				return bayPowerMeasFlag != null;
			case CorePackage.BAY__BREAKER_CONFIGURATION:
				return breakerConfiguration != BREAKER_CONFIGURATION_EDEFAULT;
			case CorePackage.BAY__BUS_BAR_CONFIGURATION:
				return busBarConfiguration != BUS_BAR_CONFIGURATION_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (breakerConfiguration: ");
		result.append(breakerConfiguration);
		result.append(", busBarConfiguration: ");
		result.append(busBarConfiguration);
		result.append(')');
		return result.toString();
	}

} //BayImpl
